home *** CD-ROM | disk | FTP | other *** search
/ MacFormat España 15 / macformat_15.iso / C de cerca / Codewarrior Lite / MacOS Support / Headers / ANSI Headers / console.h < prev    next >
Text File  |  1995-12-29  |  3KB  |  109 lines

  1. /*
  2.  *    File:        console.h
  3.  *                ©1993-1995 metrowerks Inc. All rights reserved
  4.  *    Author:        Berardino E. Baratta
  5.  *
  6.  *    Content:    Interface file to ANSI console package ...
  7.  */
  8.  
  9. #ifndef __CONSOLE__
  10. #define __CONSOLE__
  11.  
  12. #pragma options align=mac68k
  13.  
  14. #if __CFM68K__ && __USING_IMPORTED_ANSI__
  15. #pragma import on
  16. #endif
  17.  
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21.  
  22. /*
  23.  *    Provides an interface to allow users to set argc & argv on the Mac
  24.  */
  25. extern int ccommand(char ***);
  26.  
  27. /*
  28.  *    The following five functions provide the UI for the console package.
  29.  *    Users wishing to replace SIOUX with their own console package need
  30.  *    only provide the five functions below in a library.
  31.  */
  32.  
  33. /*
  34.  *    extern short InstallConsole(short fd);
  35.  *
  36.  *    Installs the Console package, this function will be called right
  37.  *    before any read or write to one of the standard streams.
  38.  *
  39.  *    short fd:        The stream which we are reading/writing to/from.
  40.  *    returns short:    0 no error occurred, anything else error.
  41.  */
  42.  
  43. extern short InstallConsole(short fd);
  44.  
  45. /*
  46.  *    extern void RemoveConsole(void);
  47.  *
  48.  *    Removes the console package.  It is called after all other streams
  49.  *    are closed and exit functions (installed by either atexit or _atexit)
  50.  *    have been called.  Since there is no way to recover from an error,
  51.  *    this function doesn't need to return any.
  52.  */
  53.  
  54. extern void RemoveConsole(void);
  55.  
  56. /*
  57.  *    extern long WriteCharsToConsole(char *buffer, long n);
  58.  *
  59.  *    Writes a stream of output to the Console window.  This function is
  60.  *    called by write.
  61.  *
  62.  *    char *buffer:    Pointer to the buffer to be written.
  63.  *    long n:            The length of the buffer to be written.
  64.  *    returns short:    Actual number of characters written to the stream,
  65.  *                    -1 if an error occurred.
  66.  */
  67.  
  68. extern long WriteCharsToConsole(char *buffer, long n);
  69.  
  70. /*
  71.  *    extern long ReadCharsFromConsole(char *buffer, long n);
  72.  *
  73.  *    Reads from the Console into a buffer.  This function is called by
  74.  *    read.
  75.  *
  76.  *    char *buffer:    Pointer to the buffer which will recieve the input.
  77.  *    long n:            The maximum amount of characters to be read (size of
  78.  *                    buffer).
  79.  *    returns short:    Actual number of characters read from the stream,
  80.  *                    -1 if an error occurred.
  81.  */
  82.  
  83. extern long ReadCharsFromConsole(char *buffer, long n);
  84.  
  85. /*
  86.  *    extern char *__ttyname(long fildes);
  87.  *
  88.  *    Returns the name of the terminal associated with the file id.  The unix.h
  89.  *    function ttyname calls this function (we need to map the int to a long for
  90.  *    size of int variance).
  91.  *
  92.  *    long filedes:    The file stream's id.
  93.  *    returns char *:    A pointer to the file's name (static global data)
  94.  */
  95.  
  96. extern char *__ttyname(long fildes);
  97.  
  98. #ifdef __cplusplus
  99. }    
  100. #endif
  101.  
  102. #if __CFM68K__ && __USING_IMPORTED_ANSI__
  103. #pragma import reset
  104. #endif
  105.  
  106. #pragma options align=reset
  107.  
  108. #endif
  109.